package org.ala.tiktools.sharddb.tx;

import javax.sql.DataSource;

import org.springframework.transaction.support.DefaultTransactionStatus;

/**
 *	分布式事务status
 *	<p>	用于和原生status区分
 *
 *	@author ala
 *	@date 2025年5月7日
 */
public class ShardTransactionStatus extends DefaultTransactionStatus {
	
	
	/**
	 * 	本事务持有的dateSource
	 * 	<p>	动态数据源中的其中一个
	 */
	protected DataSource dataSource;
	/**
	 * 	事务环境
	 */
	protected ShardTransactionContext context;
	
	
	public ShardTransactionStatus(Object transaction, boolean newTransaction, boolean newSynchronization, boolean readOnly, boolean debug, Object suspendedResources) {
		super(transaction, newTransaction, newSynchronization, readOnly, debug, suspendedResources);
	}


	public DataSource getDataSource() {
		return dataSource;
	}
	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}
	public ShardTransactionStatus dataSource(DataSource dataSource) {
		setDataSource(dataSource);
		return this;
	}


	public ShardTransactionContext getContext() {
		return context;
	}
	public void setContext(ShardTransactionContext context) {
		this.context = context;
	}
}
